package com.gx.common.exception;

import com.gx.common.enums.ResultCodeEnum;

/**
 * @Author Liu-pj
 * @Date 2023/3/7 14:47
 * @Desc 自定义文件上传异常
 **/
public class MsgException extends RuntimeException {

    private String errMessage;

    public MsgException() {
        super();
    }

    public MsgException(String message) {
        super(message);
        this.errMessage = message;
    }

    public static void cast(String errMessage) {
        throw new MsgException(errMessage);
    }

    public static void cast(ResultCodeEnum resultCodeEnum) {
        throw new MsgException(resultCodeEnum.getMessage());
    }

    public String getErrMessage() {
        return errMessage;
    }
}
